<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body class="no-skin">
<!-- 以下为内容 -->
<div class="main-content1">
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>
		<ul class="breadcrumb"  style="margin-top:10px">
			<li>
				<i class="ace-icon fa fa-home home-icon"></i>
				<a href="#">后台管理</a>
			</li>
			<li class="active">角色管理</li>
		</ul>
			<!-- 路径结束 -->
	</div>

				<!-- /section:basics/content.breadcrumbs -->
	<div class="page-content">
		<div class="row">
		<div class="col-xs-12">
		<div class="tab-content no-border padding-24">
		<div id="faq-tab-1" class="tab-pane fade in active">
			<table width="100%" border="0">
				<tr>
				    <td width="9%" align="right" nowrap="nowrap"><strong>角色：</strong></td>
				    <td width="22%"><input name="roleName" type="text" id="roleName" maxlength="100" />    </td>
				    <td width="39%">
					    <button   class="btn btn-sm btn-info" type="button" onclick="initTable();">
					       <i class="ace-icon glyphicon glyphicon-search bigger-110"></i>查 询
						</button>
								
						<button class="btn btn-sm btn-warning" type="button" onclick="toAddRole();" >
						 	<i class="ace-icon glyphicon glyphicon-plus bigger-110"></i>新 增
						</button>
					</td>
			  </tr>
		</table>
	</div>
	
	<!--查询区域end-->
	<div id="faq-tab-1" class="tab-pane fade in active">
		<!--查询结果-->
		<div style="overflow-x:auto;  margin-top:10px">
			<table id="role_list_table" class="table table-striped table-bordered table-hover" style="margin:0; "  >
				<caption></caption>
				<thead>
					<tr>
						<th nowrap="nowrap" class="center"> 序号 </th>
						<th nowrap="nowrap"> 角色 </th>								    
				        <th nowrap="nowrap" >描述</th>
				        <th nowrap="nowrap">操作</th>
				    </tr>
				</thead>
				<tbody>
		      	</tbody>
		   </table>
		</div>
	</div>
	</div>
	</div>
	</div>
	</div>
	</div>
	<script type="text/javascript">
	     jQuery(function($) {
			initTable();
		});
		function initTable(){
			$("#role_list_table").dataTable().fnDestroy();
			json={};
			json.showLineNuber=true;
			json.id="role_list_table";
		    json.url=contextPath+'/auth/role/getListData.json';
		    json.param=[{"name" : "roleName","value" : $.trim($("#roleName").val())}];
		    json.columns=[  {"sWidth": "20px","sClass":"text-center"},
							{"mData" : "roleName","sWidth": "100px","sClass":"text-center"},
								{"mData" : "remark","sWidth": "100px","sClass":"text-center"},
								{"mData" : "roleId","sWidth": "100px","sClass":"text-center",
								"mRender" : function(data, type, row) 
								{
									if(data){
										return '&nbsp;&nbsp;<a style="color:#428bca" href="../../auth/role/toEditRole.htm?roleId='+data+'" >修改</a>&nbsp;&nbsp;<a style="color:#428bca" href="javascript:toDeleteRole('+data+')" >删除</a>&nbsp;&nbsp;';
									}
								}
							}
					];
		    var oTable1=TableManaged(json).init();
		}
		
		
		
		
		
		
		function toAddRole(){
			window.location.href="../../auth/role/toAddRole.htm";
		}
		
		function toDeleteRole(roleId){
			$.Confirm('请确认是否删除该角色？','',function(){
	        	deleteRole(roleId);
	    	});
		}
		
		function deleteRole(roleId){
				 $.ajax({
		           url : contextPath + "/auth/role/deleteRole.json",
		           type : "post",
		           data : {roleId:roleId},
		           async : false,
		           success : function(data){
		             var msg = eval("("+data+")");
		             $.Alert(msg.message,'',toRoleManage);
		           },
		           error : function(){
		             //$.Alert("服务异常，请稍后尝试！");
		           }
		         });
		}
		
		function toRoleManage(){
			location.href = "../../auth/role/toRoleManage.htm";
		}
	</script>
</body>
</html>
